export default {
  props: {
    paginationOption: {
      type: Object
    }
  },
  computed: {
    calcPaginationOption() {
      let option = {
        pageSizeOptions: ['10', '20', '30', '40', '50', '100', '150', '200'],
        showTotal: (total) => `${this.$i18n('orgrole.total_items', total)}`,
        showSizeChanger: true,
        pageSize: this.paginationPageSize
      };
      let baseOption = this.paginationOption || {};
      return { ...option, ...baseOption };
    }
  },
  data() {
    return {
      paginationPageSize: window._pageSize || 20
    };
  },
  created() {},
  methods: {
    paginationChange(page, pageSize) {
      // 如果开启了全页面选中
      if (this.rowSelection && this.rowSelection.selectAllPages) {
        this.selectedAllRowKeys = [];
        this.selectedAllRows = [];
      }
      this.paginationPageSize = pageSize;
      this.$emit('paginationChange', page, pageSize);
    },
    paginationShowSizeChange(page, pageSize) {
      // 如果开启了全页面选中
      if (this.rowSelection && this.rowSelection.selectAllPages) {
        this.selectedAllRowKeys = [];
        this.selectedAllRows = [];
      }
      this.paginationPageSize = pageSize;
      this.$emit('paginationShowSizeChange', page, pageSize);
    }
  },
  watch: {},
  mounted() {}
};
